const util ={
	//判断code信息是否存在
	  getUrlParam(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null) {
			return unescape(r[2]);
		}
		return null;
	 },
	 
	 getUrlParam2(key){
	    var url = location.search;  
	    var theRequest = new Object();
	    if (url.indexOf("?") != -1) 
	    {
	        var str = url.substr(1);
	        strs = str.split("&");
	        for (var i = 0; i < strs.length; i++) 
	        {
	            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
	        }
	    }
	    var value = theRequest[key];
	    return value;
	 },
	 getUrlKey: function(name) {
	 	return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[
	 		1].replace(/\+/g, '%20')) || null;
	 },
}
export default util